package vns.client.view;

import vns.client.presenter.RuleSetDetailPresenter;
import vns.shared.RuleSetDTO;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.TextArea;

public class RuleSetDetailUI extends Composite implements RuleSetDetailPresenter.Display{
	private RuleSetDTO currentRuleSetDTO;
	
	private static ObjectTypeDetailUiBinder uiBinder = GWT
			.create(ObjectTypeDetailUiBinder.class);
	@UiField HTMLPanel htmlPanelTop;
	@UiField HTMLPanel htmlPanelMiddle;
	@UiField HTMLPanel htmlPanelBottom;
	@UiField TextArea txtaCondition;
	@UiField Button btUpdate;
	@UiField Button btCancel;
	
	private RuleParamUI ruleParamUI;
	private RuleActionUI ruleActionUI;

	interface ObjectTypeDetailUiBinder extends
			UiBinder<Widget, RuleSetDetailUI> {
	}

	public RuleSetDetailUI() {
		initWidget(uiBinder.createAndBindUi(this));
		bind();
	}

	private void bind() {
		ruleParamUI = new RuleParamUI(currentRuleSetDTO);
		this.htmlPanelTop.clear();
		this.htmlPanelTop.add(ruleParamUI);
		ruleActionUI = new RuleActionUI(currentRuleSetDTO);
		this.htmlPanelBottom.clear();
		this.htmlPanelBottom.add(ruleActionUI);
	}
	/***************************************************************************/

	@Override
	public void render() {
	}

	@Override
	public Button getUpdateButton() {
		return btUpdate;
	}

	@Override
	public Button getCalcelButton() {
		return btCancel;
	}
}
